package com.taikang.t.helper;

import java.io.Reader;
import java.io.StringReader;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

public class IKHelpeer {

	public static String distinguish(String sentence){
		StringBuffer sb = new StringBuffer();
		Reader reader  = new StringReader(sentence);
		//先分词
		IKSegmenter ik = new IKSegmenter(reader, true);
		try{
			while(true){
				Lexeme word = ik.next();
				if(word==null)
				{
					break;
				}
				else
				{
					System.out.println(word);
					sb.append(word.getLexemeText()+" ");
				}
			}
		}catch(Exception e)
		{
			e.printStackTrace();
		}
		return sb.toString().trim();
	}
}
